/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.colswe.testingProject.view;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import org.colswe.testingProject.entity.Person;

/**
 *
 * @author andres
 */
public class MainWindow extends JFrame {

    private JPanel pnlMain;
    private JTabbedPane tbpTabs;
    private WelcomePanel pnlWelcome;
    private AdminUsersPanel pnlAdmUser;

    public MainWindow(String role) {
        this.initComponents(role);
    }

    private void initComponents(String role) {

        this.pnlMain = new JPanel();
        this.tbpTabs = new JTabbedPane();
        this.pnlWelcome = new WelcomePanel();
        this.tbpTabs.setSize(WIDTH, HEIGHT);
        this.tbpTabs.addTab("Bienvenida", this.pnlWelcome);
        if (role.equals(Person.ADMINISTRATOR) || role.equals(Person.USERS_ADMINISTRATOR)) {
            this.pnlAdmUser = new AdminUsersPanel();
            this.tbpTabs.addTab("Administración de Usuarios", this.pnlAdmUser);
        }
        this.pnlMain.add(this.tbpTabs);

        this.setDefaultCloseOperation(MainWindow.EXIT_ON_CLOSE);
        this.setLocationByPlatform(true);
        this.setSize(1000, 650);
        this.setResizable(false);

        this.getContentPane().add(this.pnlMain);

    }
}
